﻿namespace HRM.CORE.Process
{
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Base;
    using DevExpress.XtraGrid.Views.Grid;
    using DevExpress.XtraLayout;
    using DevExpress.XtraLayout.Utils;
    using APP.HELPER;
    using Common.Class; using APP.HELPER.Utils.Language; using Security.Security; using Dictionary.ERP;
    using HRM.CORE;
    using Extra;
    
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms; using Common;
    using Security.ERP;

    public class xucRateAdd : Common.xucBaseAddH
    {
        private SimpleButton bbiReload;
        private CalcEdit calMinus;
        private CalcEdit calMyPlus;
        private CalcEdit calOwnerPlus;
        private CheckEdit cheIsDiscipline;
        private CheckEdit cheIsRecidivism;
        private GridColumn colCoefficient;
        private GridColumn colContent;
        private GridColumn colEmployeeCode;
        private GridColumn colFirstName;
        private GridColumn colLastName;
        private GridColumn colRate;
        private GridColumn colRateDetailID;
        private GridColumn colRateID;
        private GridColumn colScore;
        private GridColumn colSelfRate;
        private GridColumn colSelfScore;
        private GridColumn colSort;
        private IContainer components = null;
        private DateEdit dtDate;
        private EmptySpaceItem emptySpaceItem1;
        private EmptySpaceItem emptySpaceItem2;
        private EmptySpaceItem emptySpaceItem3;
        private GridView gbList;
        private GridControl gcList;
        private GridLookUpEdit glkEmployeeCode;
        private GridView gridLookUpEdit1View;
        private GridView gridView2;
        private GroupControl grInformation;
        private HRM_PROCESS_RATE l_Rate = new HRM_PROCESS_RATE();
        private LabelControl labelControl1;
        private LabelControl labelControl2;
        private LabelControl labelControl3;
        private LabelControl labelControl8;
        private LayoutControl layoutControl1;
        private LayoutControlGroup layoutControlGroup1;
        private LayoutControlItem layoutControlItem1;
        private LayoutControlItem layoutControlItem10;
        private LayoutControlItem layoutControlItem11;
        private LayoutControlItem layoutControlItem12;
        private LayoutControlItem layoutControlItem13;
        private LayoutControlItem layoutControlItem2;
        private LayoutControlItem layoutControlItem3;
        private LayoutControlItem layoutControlItem4;
        private LayoutControlItem layoutControlItem5;
        private LayoutControlItem layoutControlItem6;
        private LayoutControlItem layoutControlItem7;
        private LayoutControlItem layoutControlItem8;
        private LayoutControlItem layoutControlItem9;
        private string m_EmployeeCode = "";
        private Guid m_RateID = Guid.NewGuid();
        private RepositoryItemCalcEdit repCal;
        private MemoEdit txtDescription;
        private TextEdit txtEmployeeName;
        private TextEdit txtMyRate;
        private TextEdit txtOwnerRate;
        private MemoEdit txtViolation;

        public event SuccessEventHander Success;

        public xucRateAdd()
        {
            this.InitializeComponent();
            this.InitMultiLanguages();
            this.InitData();
            this.InitComponent();
        }

        protected override void Add()
        {
            base.Add();
            HRM_PROCESS_RATE hrm_process_rate = new HRM_PROCESS_RATE();
        }

        private void bbiReload_Click(object sender, EventArgs e)
        {
            this.CreateListRate();
        }

        private void cheIsDiscipline_CheckedChanged(object sender, EventArgs e)
        {
            this.SetRate();
        }

        public void Clear()
        {
        }

        private void CreateListRate()
        {
            this.gcList.DataSource = new HRM_PROCESS_RATEDETAIL().CreateList(this.m_EmployeeCode, this.m_RateID);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void gbList_CellValueChanged(object sender, CellValueChangedEventArgs e)
        {
            if ((e.Column != this.colSelfRate) && (e.Column != this.colRate))
            {
                double num = 0.0;
                double num2 = 0.0;
                num = double.Parse(this.gbList.GetRowCellValue(e.RowHandle, this.colSelfScore).ToString());
                num2 = double.Parse(this.gbList.GetRowCellValue(e.RowHandle, this.colScore).ToString());
                if (num > 10.0)
                {
                    this.gbList.SetRowCellValue(e.RowHandle, this.colSelfScore, 10);
                }
                else if (num2 > 10.0)
                {
                    this.gbList.SetRowCellValue(e.RowHandle, this.colScore, 10);
                }
                else if (num < 0.0)
                {
                    this.gbList.SetRowCellValue(e.RowHandle, this.colSelfScore, 0);
                }
                else if (num2 < 0.0)
                {
                    this.gbList.SetRowCellValue(e.RowHandle, this.colScore, 0);
                }
                else
                {
                    if ((num >= 9.0) && (num <= 10.0))
                    {
                        this.gbList.SetRowCellValue(e.RowHandle, this.colSelfRate, "A");
                    }
                    else if ((num >= 8.0) && (num < 9.0))
                    {
                        this.gbList.SetRowCellValue(e.RowHandle, this.colSelfRate, "B");
                    }
                    else if ((num >= 7.0) && (num < 8.0))
                    {
                        this.gbList.SetRowCellValue(e.RowHandle, this.colSelfRate, "C");
                    }
                    else if (num < 7.0)
                    {
                        this.gbList.SetRowCellValue(e.RowHandle, this.colSelfRate, "D");
                    }
                    if ((num2 >= 9.0) && (num2 <= 10.0))
                    {
                        this.gbList.SetRowCellValue(e.RowHandle, this.colRate, "A");
                    }
                    else if ((num2 >= 8.0) && (num2 < 9.0))
                    {
                        this.gbList.SetRowCellValue(e.RowHandle, this.colRate, "B");
                    }
                    else if ((num2 >= 7.0) && (num2 < 8.0))
                    {
                        this.gbList.SetRowCellValue(e.RowHandle, this.colRate, "C");
                    }
                    else if (num2 < 7.0)
                    {
                        this.gbList.SetRowCellValue(e.RowHandle, this.colRate, "D");
                    }
                    this.gbList.UpdateSummary();
                    this.SetRate();
                }
            }
        }

        private void gbList_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e)
        {
            if (e.RowHandle == -2147483648)
            {
                e.Handled = true;
                e.Painter.DrawObject(e.Info);
                Rectangle bounds = e.Bounds;
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(0x3f, 0xa5, 0xa5, 0)), bounds);
                bounds.Height--;
                bounds.Width--;
                e.Graphics.DrawRectangle(Pens.Blue, bounds);
            }
            int rowHandle = e.RowHandle;
            if (rowHandle >= 0)
            {
                rowHandle++;
                e.Info.DisplayText = rowHandle.ToString();
            }
        }

        private void glkEmployeeCode_EditValueChanged(object sender, EventArgs e)
        {
            this.m_EmployeeCode = this.glkEmployeeCode.EditValue.ToString();
            this.LoadEmployeeInformation();
        }

        protected override void Init()
        {
        }

        private void InitComponent()
        {
            this.dtDate.DateTime = System.DateTime.Now;
            this.calMinus.EditValue = 0;
            this.calMyPlus.EditValue = 0;
            this.calOwnerPlus.EditValue = 0;
            this.txtMyRate.Text = "D";
            this.txtOwnerRate.Text = "D";
        }

        private void InitData()
        {
            new HRM_EMPLOYEE().AddGridLookupEdit(this.glkEmployeeCode);
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(xucRateAdd));
            StyleFormatCondition condition = new StyleFormatCondition();
            StyleFormatCondition condition2 = new StyleFormatCondition();
            this.colSelfRate = new GridColumn();
            this.colRate = new GridColumn();
            this.grInformation = new GroupControl();
            this.layoutControl1 = new LayoutControl();
            this.cheIsDiscipline = new CheckEdit();
            this.labelControl3 = new LabelControl();
            this.txtDescription = new MemoEdit();
            this.labelControl2 = new LabelControl();
            this.dtDate = new DateEdit();
            this.txtOwnerRate = new TextEdit();
            this.calOwnerPlus = new CalcEdit();
            this.txtMyRate = new TextEdit();
            this.labelControl1 = new LabelControl();
            this.calMyPlus = new CalcEdit();
            this.calMinus = new CalcEdit();
            this.cheIsRecidivism = new CheckEdit();
            this.txtViolation = new MemoEdit();
            this.layoutControlGroup1 = new LayoutControlGroup();
            this.layoutControlItem1 = new LayoutControlItem();
            this.layoutControlItem3 = new LayoutControlItem();
            this.layoutControlItem4 = new LayoutControlItem();
            this.layoutControlItem5 = new LayoutControlItem();
            this.layoutControlItem6 = new LayoutControlItem();
            this.layoutControlItem7 = new LayoutControlItem();
            this.layoutControlItem8 = new LayoutControlItem();
            this.layoutControlItem9 = new LayoutControlItem();
            this.layoutControlItem10 = new LayoutControlItem();
            this.layoutControlItem11 = new LayoutControlItem();
            this.layoutControlItem2 = new LayoutControlItem();
            this.emptySpaceItem3 = new EmptySpaceItem();
            this.layoutControlItem12 = new LayoutControlItem();
            this.layoutControlItem13 = new LayoutControlItem();
            this.emptySpaceItem1 = new EmptySpaceItem();
            this.emptySpaceItem2 = new EmptySpaceItem();
            this.gcList = new GridControl();
            this.gbList = new GridView();
            this.colRateDetailID = new GridColumn();
            this.colRateID = new GridColumn();
            this.colContent = new GridColumn();
            this.colCoefficient = new GridColumn();
            this.colSelfScore = new GridColumn();
            this.repCal = new RepositoryItemCalcEdit();
            this.colScore = new GridColumn();
            this.colSort = new GridColumn();
            this.gridView2 = new GridView();
            this.bbiReload = new SimpleButton();
            this.labelControl8 = new LabelControl();
            this.txtEmployeeName = new TextEdit();
            this.glkEmployeeCode = new GridLookUpEdit();
            this.gridLookUpEdit1View = new GridView();
            this.colEmployeeCode = new GridColumn();
            this.colFirstName = new GridColumn();
            this.colLastName = new GridColumn();
            ((ISupportInitialize) base.Err).BeginInit();
            base.imageCollection2.BeginInit();
            this.grInformation.BeginInit();
            this.grInformation.SuspendLayout();
            this.layoutControl1.BeginInit();
            this.layoutControl1.SuspendLayout();
            this.cheIsDiscipline.Properties.BeginInit();
            this.txtDescription.Properties.BeginInit();
            this.dtDate.Properties.VistaTimeProperties.BeginInit();
            this.dtDate.Properties.BeginInit();
            this.txtOwnerRate.Properties.BeginInit();
            this.calOwnerPlus.Properties.BeginInit();
            this.txtMyRate.Properties.BeginInit();
            this.calMyPlus.Properties.BeginInit();
            this.calMinus.Properties.BeginInit();
            this.cheIsRecidivism.Properties.BeginInit();
            this.txtViolation.Properties.BeginInit();
            this.layoutControlGroup1.BeginInit();
            this.layoutControlItem1.BeginInit();
            this.layoutControlItem3.BeginInit();
            this.layoutControlItem4.BeginInit();
            this.layoutControlItem5.BeginInit();
            this.layoutControlItem6.BeginInit();
            this.layoutControlItem7.BeginInit();
            this.layoutControlItem8.BeginInit();
            this.layoutControlItem9.BeginInit();
            this.layoutControlItem10.BeginInit();
            this.layoutControlItem11.BeginInit();
            this.layoutControlItem2.BeginInit();
            this.emptySpaceItem3.BeginInit();
            this.layoutControlItem12.BeginInit();
            this.layoutControlItem13.BeginInit();
            this.emptySpaceItem1.BeginInit();
            this.emptySpaceItem2.BeginInit();
            this.gcList.BeginInit();
            this.gbList.BeginInit();
            this.repCal.BeginInit();
            this.gridView2.BeginInit();
            this.txtEmployeeName.Properties.BeginInit();
            this.glkEmployeeCode.Properties.BeginInit();
            this.gridLookUpEdit1View.BeginInit();
            base.SuspendLayout();
            base.btnSave.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            base.btnSave.Location = new Point(0x199, 0x231);
            base.btnSave.Size = new Size(0x5f, 0x1b);
            base.btnSave.TabIndex = 1;
            base.btnCancel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            base.btnCancel.Location = new Point(510, 0x231);
            base.btnCancel.TabIndex = 3;
            base.btnSaveNew.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            base.btnSaveNew.Location = new Point(0x199, 0x231);
            base.btnSaveNew.TabIndex = 2;
            base.imageCollection2.ImageStream = (ImageCollectionStreamer) manager.GetObject("imageCollection2.ImageStream");
            this.colSelfRate.AppearanceCell.Font = new Font("Tahoma", 8.25f, FontStyle.Italic | FontStyle.Bold);
            this.colSelfRate.AppearanceCell.Options.UseFont = true;
            this.colSelfRate.AppearanceCell.Options.UseTextOptions = true;
            this.colSelfRate.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center;
            this.colSelfRate.Caption = "Tự xếp loại";
            this.colSelfRate.FieldName = "SelfRate";
            this.colSelfRate.Name = "colSelfRate";
            this.colSelfRate.Visible = true;
            this.colSelfRate.VisibleIndex = 2;
            this.colSelfRate.Width = 0x40;
            this.colRate.AppearanceCell.Font = new Font("Tahoma", 8.25f, FontStyle.Italic | FontStyle.Bold);
            this.colRate.AppearanceCell.Options.UseFont = true;
            this.colRate.AppearanceCell.Options.UseTextOptions = true;
            this.colRate.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center;
            this.colRate.Caption = "TBP xếp loại";
            this.colRate.FieldName = "Rate";
            this.colRate.Name = "colRate";
            this.colRate.Visible = true;
            this.colRate.VisibleIndex = 4;
            this.colRate.Width = 0x48;
            this.grInformation.Controls.Add(this.layoutControl1);
            this.grInformation.Controls.Add(this.gcList);
            this.grInformation.Location = new Point(0, 40);
            this.grInformation.Name = "grInformation";
            this.grInformation.Size = new Size(0x269, 0x1ff);
            this.grInformation.TabIndex = 0;
            this.grInformation.Text = "Th\x00f4ng Tin Đ\x00e1nh gi\x00e1";
            this.layoutControl1.Controls.Add(this.cheIsDiscipline);
            this.layoutControl1.Controls.Add(this.labelControl3);
            this.layoutControl1.Controls.Add(this.txtDescription);
            this.layoutControl1.Controls.Add(this.labelControl2);
            this.layoutControl1.Controls.Add(this.dtDate);
            this.layoutControl1.Controls.Add(this.txtOwnerRate);
            this.layoutControl1.Controls.Add(this.calOwnerPlus);
            this.layoutControl1.Controls.Add(this.txtMyRate);
            this.layoutControl1.Controls.Add(this.labelControl1);
            this.layoutControl1.Controls.Add(this.calMyPlus);
            this.layoutControl1.Controls.Add(this.calMinus);
            this.layoutControl1.Controls.Add(this.cheIsRecidivism);
            this.layoutControl1.Controls.Add(this.txtViolation);
            this.layoutControl1.Location = new Point(7, 0x14e);
            this.layoutControl1.Name = "layoutControl1";
            this.layoutControl1.OptionsView.HighlightFocusedItem = true;
            this.layoutControl1.Root = this.layoutControlGroup1;
            this.layoutControl1.Size = new Size(0x25c, 0xa8);
            this.layoutControl1.TabIndex = 1;
            this.layoutControl1.Text = "layoutControl1";
            this.cheIsDiscipline.Location = new Point(0x9e, 0x2b);
            this.cheIsDiscipline.Name = "cheIsDiscipline";
            this.cheIsDiscipline.Properties.Caption = "Trong th\x00e1ng bị xử l\x00fd kỷ luật bằng văn bản";
            this.cheIsDiscipline.Size = new Size(0x1bc, 0x13);
            this.cheIsDiscipline.StyleController = this.layoutControl1;
            this.cheIsDiscipline.TabIndex = 13;
            this.cheIsDiscipline.CheckedChanged += new EventHandler(this.cheIsDiscipline_CheckedChanged);
            this.labelControl3.Location = new Point(0x11a, 0x45);
            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new Size(0x16, 13);
            this.labelControl3.StyleController = this.layoutControl1;
            this.labelControl3.TabIndex = 12;
            this.labelControl3.Text = "điểm";
            this.txtDescription.Location = new Point(0x7b, 0x8a);
            this.txtDescription.Name = "txtDescription";
            this.txtDescription.Size = new Size(0x1df, 0x1c);
            this.txtDescription.StyleController = this.layoutControl1;
            this.txtDescription.TabIndex = 11;
            this.labelControl2.Location = new Point(0x11a, 0x75);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new Size(0x16, 13);
            this.labelControl2.StyleController = this.layoutControl1;
            this.labelControl2.TabIndex = 5;
            this.labelControl2.Text = "điểm";
            this.dtDate.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.dtDate.EditValue = null;
            this.dtDate.Location = new Point(0x1f7, 0x42);
            this.dtDate.Name = "dtDate";
            this.dtDate.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.dtDate.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.dtDate.Size = new Size(0x63, 20);
            this.dtDate.StyleController = this.layoutControl1;
            this.dtDate.TabIndex = 1;
            this.txtOwnerRate.Location = new Point(0x1f7, 0x72);
            this.txtOwnerRate.Name = "txtOwnerRate";
            this.txtOwnerRate.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtOwnerRate.Properties.Appearance.Options.UseFont = true;
            this.txtOwnerRate.Size = new Size(0x63, 20);
            this.txtOwnerRate.StyleController = this.layoutControl1;
            this.txtOwnerRate.TabIndex = 9;
            this.txtOwnerRate.TextChanged += new EventHandler(this.txtOwnerRate_TextChanged);
            this.calOwnerPlus.Location = new Point(0xb5, 0x72);
            this.calOwnerPlus.Name = "calOwnerPlus";
            this.calOwnerPlus.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calOwnerPlus.Properties.Appearance.Options.UseFont = true;
            this.calOwnerPlus.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calOwnerPlus.Size = new Size(0x61, 20);
            this.calOwnerPlus.StyleController = this.layoutControl1;
            this.calOwnerPlus.TabIndex = 2;
            this.txtMyRate.Location = new Point(0x1f7, 90);
            this.txtMyRate.Name = "txtMyRate";
            this.txtMyRate.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtMyRate.Properties.Appearance.Options.UseFont = true;
            this.txtMyRate.Size = new Size(0x63, 20);
            this.txtMyRate.StyleController = this.layoutControl1;
            this.txtMyRate.TabIndex = 8;
            this.txtMyRate.TextChanged += new EventHandler(this.txtMyRate_TextChanged);
            this.labelControl1.Location = new Point(0x11a, 0x5d);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new Size(0x16, 13);
            this.labelControl1.StyleController = this.layoutControl1;
            this.labelControl1.TabIndex = 10;
            this.labelControl1.Text = "điểm";
            this.calMyPlus.Location = new Point(0xb5, 90);
            this.calMyPlus.Name = "calMyPlus";
            this.calMyPlus.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calMyPlus.Properties.Appearance.Options.UseFont = true;
            this.calMyPlus.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calMyPlus.Size = new Size(0x61, 20);
            this.calMyPlus.StyleController = this.layoutControl1;
            this.calMyPlus.TabIndex = 7;
            this.calMinus.Location = new Point(0xb5, 0x42);
            this.calMinus.Name = "calMinus";
            this.calMinus.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calMinus.Size = new Size(0x61, 20);
            this.calMinus.StyleController = this.layoutControl1;
            this.calMinus.TabIndex = 6;
            this.cheIsRecidivism.Location = new Point(2, 0x2b);
            this.cheIsRecidivism.Name = "cheIsRecidivism";
            this.cheIsRecidivism.Properties.Caption = "Lỗi thuộc diện t\x00e1i phạm";
            this.cheIsRecidivism.Size = new Size(0x98, 0x13);
            this.cheIsRecidivism.StyleController = this.layoutControl1;
            this.cheIsRecidivism.TabIndex = 5;
            this.txtViolation.Location = new Point(0x7c, 2);
            this.txtViolation.Name = "txtViolation";
            this.txtViolation.Size = new Size(0x1de, 0x25);
            this.txtViolation.StyleController = this.layoutControl1;
            this.txtViolation.TabIndex = 4;
            this.layoutControlGroup1.CustomizationFormText = "layoutControlGroup1";
            this.layoutControlGroup1.EnableIndentsWithoutBorders = DefaultBoolean.True;
            this.layoutControlGroup1.GroupBordersVisible = false;
            this.layoutControlGroup1.Items.AddRange(new BaseLayoutItem[] { this.layoutControlItem1, this.layoutControlItem3, this.layoutControlItem4, this.layoutControlItem5, this.layoutControlItem6, this.layoutControlItem7, this.layoutControlItem8, this.layoutControlItem9, this.layoutControlItem10, this.layoutControlItem11, this.layoutControlItem2, this.emptySpaceItem3, this.layoutControlItem12, this.layoutControlItem13, this.emptySpaceItem1, this.emptySpaceItem2 });
            this.layoutControlGroup1.Location = new Point(0, 0);
            this.layoutControlGroup1.Name = "layoutControlGroup1";
            this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
            this.layoutControlGroup1.Size = new Size(0x25c, 0xa8);
            this.layoutControlGroup1.Spacing = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
            this.layoutControlGroup1.Text = "layoutControlGroup1";
            this.layoutControlGroup1.TextVisible = false;
            this.layoutControlItem1.Control = this.txtViolation;
            this.layoutControlItem1.CustomizationFormText = "Lỗi vi phạm trong th\x00e1ng:";
            this.layoutControlItem1.Location = new Point(0, 0);
            this.layoutControlItem1.Name = "layoutControlItem1";
            this.layoutControlItem1.Size = new Size(0x25c, 0x29);
            this.layoutControlItem1.Text = "Lỗi vi phạm trong th\x00e1ng:";
            this.layoutControlItem1.TextAlignMode = TextAlignModeItem.AutoSize;
            this.layoutControlItem1.TextSize = new Size(0x75, 13);
            this.layoutControlItem1.TextToControlDistance = 5;
            this.layoutControlItem3.Control = this.calMinus;
            this.layoutControlItem3.CustomizationFormText = "Tổng điểm trừ vi phạm trong th\x00e1ng:";
            this.layoutControlItem3.Location = new Point(0, 0x40);
            this.layoutControlItem3.Name = "layoutControlItem3";
            this.layoutControlItem3.Size = new Size(280, 0x18);
            this.layoutControlItem3.Text = "Tổng điểm trừ vi phạm trong th\x00e1ng:";
            this.layoutControlItem3.TextSize = new Size(0xaf, 13);
            this.layoutControlItem4.Control = this.calMyPlus;
            this.layoutControlItem4.CustomizationFormText = "Phần d\x00e0nh cho c\x00e1n bộ tự cộng điểm:";
            this.layoutControlItem4.Location = new Point(0, 0x58);
            this.layoutControlItem4.Name = "layoutControlItem4";
            this.layoutControlItem4.Size = new Size(280, 0x18);
            this.layoutControlItem4.Text = "Phần d\x00e0nh cho c\x00e1n bộ tự cộng điểm:";
            this.layoutControlItem4.TextSize = new Size(0xaf, 13);
            this.layoutControlItem5.Control = this.txtMyRate;
            this.layoutControlItem5.CustomizationFormText = "Xếp loại:";
            this.layoutControlItem5.Location = new Point(0x1c5, 0x58);
            this.layoutControlItem5.Name = "layoutControlItem5";
            this.layoutControlItem5.Padding = new DevExpress.XtraLayout.Utils.Padding(4, 2, 2, 2);
            this.layoutControlItem5.Size = new Size(0x97, 0x18);
            this.layoutControlItem5.Text = "Xếp loại:";
            this.layoutControlItem5.TextAlignMode = TextAlignModeItem.AutoSize;
            this.layoutControlItem5.TextSize = new Size(0x29, 13);
            this.layoutControlItem5.TextToControlDistance = 5;
            this.layoutControlItem6.Control = this.calOwnerPlus;
            this.layoutControlItem6.CustomizationFormText = "Phần d\x00e0nh cho TBP cộng điểm:";
            this.layoutControlItem6.Location = new Point(0, 0x70);
            this.layoutControlItem6.Name = "layoutControlItem6";
            this.layoutControlItem6.Size = new Size(280, 0x18);
            this.layoutControlItem6.Text = "Phần d\x00e0nh cho TBP cộng điểm:";
            this.layoutControlItem6.TextSize = new Size(0xaf, 13);
            this.layoutControlItem7.Control = this.txtOwnerRate;
            this.layoutControlItem7.CustomizationFormText = "Xếp loại:";
            this.layoutControlItem7.Location = new Point(0x1c5, 0x70);
            this.layoutControlItem7.Name = "layoutControlItem7";
            this.layoutControlItem7.Padding = new DevExpress.XtraLayout.Utils.Padding(4, 2, 2, 2);
            this.layoutControlItem7.Size = new Size(0x97, 0x18);
            this.layoutControlItem7.Text = "Xếp loại:";
            this.layoutControlItem7.TextAlignMode = TextAlignModeItem.AutoSize;
            this.layoutControlItem7.TextSize = new Size(0x29, 13);
            this.layoutControlItem7.TextToControlDistance = 5;
            this.layoutControlItem8.Control = this.dtDate;
            this.layoutControlItem8.CustomizationFormText = "Ng\x00e0y đ\x00e1nh gi\x00e1:";
            this.layoutControlItem8.Location = new Point(0x1a7, 0x40);
            this.layoutControlItem8.Name = "layoutControlItem8";
            this.layoutControlItem8.Size = new Size(0xb5, 0x18);
            this.layoutControlItem8.Text = "Ng\x00e0y đ\x00e1nh gi\x00e1:";
            this.layoutControlItem8.TextAlignMode = TextAlignModeItem.AutoSize;
            this.layoutControlItem8.TextSize = new Size(0x49, 13);
            this.layoutControlItem8.TextToControlDistance = 5;
            this.layoutControlItem9.Control = this.labelControl1;
            this.layoutControlItem9.CustomizationFormText = "layoutControlItem9";
            this.layoutControlItem9.Location = new Point(280, 0x58);
            this.layoutControlItem9.Name = "layoutControlItem9";
            this.layoutControlItem9.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 5, 2);
            this.layoutControlItem9.Size = new Size(0x1a, 0x18);
            this.layoutControlItem9.Text = "layoutControlItem9";
            this.layoutControlItem9.TextSize = new Size(0, 0);
            this.layoutControlItem9.TextToControlDistance = 0;
            this.layoutControlItem9.TextVisible = false;
            this.layoutControlItem10.Control = this.labelControl2;
            this.layoutControlItem10.CustomizationFormText = "layoutControlItem10";
            this.layoutControlItem10.Location = new Point(280, 0x70);
            this.layoutControlItem10.Name = "layoutControlItem10";
            this.layoutControlItem10.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 5, 2);
            this.layoutControlItem10.Size = new Size(0x1a, 0x18);
            this.layoutControlItem10.Text = "layoutControlItem10";
            this.layoutControlItem10.TextSize = new Size(0, 0);
            this.layoutControlItem10.TextToControlDistance = 0;
            this.layoutControlItem10.TextVisible = false;
            this.layoutControlItem11.Control = this.txtDescription;
            this.layoutControlItem11.CustomizationFormText = "Nhận x\x00e9t của ban gi\x00e1m đốc:";
            this.layoutControlItem11.Location = new Point(0, 0x88);
            this.layoutControlItem11.Name = "layoutControlItem11";
            this.layoutControlItem11.Size = new Size(0x25c, 0x20);
            this.layoutControlItem11.Text = "Nhận x\x00e9t của BGĐ:        ";
            this.layoutControlItem11.TextAlignMode = TextAlignModeItem.AutoSize;
            this.layoutControlItem11.TextSize = new Size(0x74, 13);
            this.layoutControlItem11.TextToControlDistance = 5;
            this.layoutControlItem2.Control = this.cheIsRecidivism;
            this.layoutControlItem2.CustomizationFormText = "layoutControlItem2";
            this.layoutControlItem2.Location = new Point(0, 0x29);
            this.layoutControlItem2.Name = "layoutControlItem2";
            this.layoutControlItem2.Size = new Size(0x9c, 0x17);
            this.layoutControlItem2.Text = "layoutControlItem2";
            this.layoutControlItem2.TextSize = new Size(0, 0);
            this.layoutControlItem2.TextToControlDistance = 0;
            this.layoutControlItem2.TextVisible = false;
            this.emptySpaceItem3.CustomizationFormText = "emptySpaceItem3";
            this.emptySpaceItem3.Location = new Point(0x132, 0x40);
            this.emptySpaceItem3.Name = "emptySpaceItem3";
            this.emptySpaceItem3.Size = new Size(0x75, 0x18);
            this.emptySpaceItem3.Text = "emptySpaceItem3";
            this.emptySpaceItem3.TextSize = new Size(0, 0);
            this.layoutControlItem12.Control = this.labelControl3;
            this.layoutControlItem12.CustomizationFormText = "layoutControlItem12";
            this.layoutControlItem12.Location = new Point(280, 0x40);
            this.layoutControlItem12.Name = "layoutControlItem12";
            this.layoutControlItem12.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 5, 2);
            this.layoutControlItem12.Size = new Size(0x1a, 0x18);
            this.layoutControlItem12.Text = "layoutControlItem12";
            this.layoutControlItem12.TextSize = new Size(0, 0);
            this.layoutControlItem12.TextToControlDistance = 0;
            this.layoutControlItem12.TextVisible = false;
            this.layoutControlItem13.Control = this.cheIsDiscipline;
            this.layoutControlItem13.CustomizationFormText = "layoutControlItem13";
            this.layoutControlItem13.Location = new Point(0x9c, 0x29);
            this.layoutControlItem13.Name = "layoutControlItem13";
            this.layoutControlItem13.Size = new Size(0x1c0, 0x17);
            this.layoutControlItem13.Text = "layoutControlItem13";
            this.layoutControlItem13.TextSize = new Size(0, 0);
            this.layoutControlItem13.TextToControlDistance = 0;
            this.layoutControlItem13.TextVisible = false;
            this.emptySpaceItem1.CustomizationFormText = "emptySpaceItem1";
            this.emptySpaceItem1.Location = new Point(0x132, 0x58);
            this.emptySpaceItem1.Name = "emptySpaceItem1";
            this.emptySpaceItem1.Size = new Size(0x93, 0x18);
            this.emptySpaceItem1.Text = "emptySpaceItem1";
            this.emptySpaceItem1.TextSize = new Size(0, 0);
            this.emptySpaceItem2.CustomizationFormText = "emptySpaceItem2";
            this.emptySpaceItem2.Location = new Point(0x132, 0x70);
            this.emptySpaceItem2.Name = "emptySpaceItem2";
            this.emptySpaceItem2.Size = new Size(0x93, 0x18);
            this.emptySpaceItem2.Text = "emptySpaceItem2";
            this.emptySpaceItem2.TextSize = new Size(0, 0);
            this.gcList.Dock = DockStyle.Top;
            this.gcList.Location = new Point(2, 0x16);
            this.gcList.MainView = this.gbList;
            this.gcList.Name = "gcList";
            this.gcList.RepositoryItems.AddRange(new RepositoryItem[] { this.repCal });
            this.gcList.Size = new Size(0x265, 0x132);
            this.gcList.TabIndex = 0;
            this.gcList.ViewCollection.AddRange(new BaseView[] { this.gbList, this.gridView2 });
            this.gbList.Appearance.HeaderPanel.Options.UseTextOptions = true;
            this.gbList.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
            this.gbList.Appearance.HeaderPanel.TextOptions.WordWrap = WordWrap.Wrap;
            this.gbList.BorderStyle = BorderStyles.NoBorder;
            this.gbList.ColumnPanelRowHeight = 0x24;
            this.gbList.Columns.AddRange(new GridColumn[] { this.colRateDetailID, this.colRateID, this.colContent, this.colCoefficient, this.colSelfScore, this.colSelfRate, this.colScore, this.colRate, this.colSort });
            condition.Appearance.ForeColor = Color.Red;
            condition.Appearance.Options.UseForeColor = true;
            condition.Column = this.colSelfRate;
            condition.Condition = FormatConditionEnum.Equal;
            condition.Value1 = "D";
            condition2.Appearance.ForeColor = Color.Red;
            condition2.Appearance.Options.UseForeColor = true;
            condition2.Column = this.colRate;
            condition2.Condition = FormatConditionEnum.Equal;
            condition2.Value1 = "D";
            this.gbList.FormatConditions.AddRange(new StyleFormatCondition[] { condition, condition2 });
            this.gbList.GridControl = this.gcList;
            this.gbList.IndicatorWidth = 40;
            this.gbList.Name = "gbList";
            this.gbList.OptionsSelection.InvertSelection = true;
            this.gbList.OptionsView.ShowFooter = true;
            this.gbList.OptionsView.ShowGroupPanel = false;
            this.gbList.CustomDrawRowIndicator += new RowIndicatorCustomDrawEventHandler(this.gbList_CustomDrawRowIndicator);
            this.gbList.CellValueChanged += new CellValueChangedEventHandler(this.gbList_CellValueChanged);
            this.colRateDetailID.Caption = "M\x00e3";
            this.colRateDetailID.FieldName = "RateDetailID";
            this.colRateDetailID.Name = "colRateDetailID";
            this.colRateID.Caption = "M\x00e3 nh\x00f3m";
            this.colRateID.FieldName = "RateID";
            this.colRateID.Name = "colRateID";
            this.colContent.Caption = "Nội Dung Đ\x00e1nh Gi\x00e1";
            this.colContent.FieldName = "Content";
            this.colContent.Name = "colContent";
            this.colContent.OptionsColumn.ReadOnly = true;
            this.colContent.Visible = true;
            this.colContent.VisibleIndex = 0;
            this.colContent.Width = 0x135;
            this.colCoefficient.Caption = "Hệ số";
            this.colCoefficient.FieldName = "Coefficient";
            this.colCoefficient.Name = "colCoefficient";
            this.colSelfScore.AppearanceCell.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.colSelfScore.AppearanceCell.Options.UseFont = true;
            this.colSelfScore.Caption = "Tự đ/g cho điểm";
            this.colSelfScore.ColumnEdit = this.repCal;
            this.colSelfScore.FieldName = "SelfScore";
            this.colSelfScore.Name = "colSelfScore";
            this.colSelfScore.Visible = true;
            this.colSelfScore.VisibleIndex = 1;
            this.colSelfScore.Width = 0x40;
            this.repCal.AutoHeight = false;
            this.repCal.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.repCal.Mask.UseMaskAsDisplayFormat = true;
            this.repCal.Name = "repCal";
            this.colScore.AppearanceCell.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.colScore.AppearanceCell.Options.UseFont = true;
            this.colScore.Caption = "TBP đ/g cho điểm";
            this.colScore.ColumnEdit = this.repCal;
            this.colScore.FieldName = "Score";
            this.colScore.Name = "colScore";
            this.colScore.Visible = true;
            this.colScore.VisibleIndex = 3;
            this.colScore.Width = 0x40;
            this.colSort.Caption = "Thứ tự";
            this.colSort.FieldName = "Sort";
            this.colSort.Name = "colSort";
            this.gridView2.GridControl = this.gcList;
            this.gridView2.Name = "gridView2";
            this.bbiReload.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.bbiReload.Image = MsgResc.filter;
            this.bbiReload.Location = new Point(7, 0x231);
            this.bbiReload.Name = "bbiReload";
            this.bbiReload.Size = new Size(0xa4, 0x1b);
            this.bbiReload.TabIndex = 5;
            this.bbiReload.Text = "Nạp Lại";
            this.bbiReload.Click += new EventHandler(this.bbiReload_Click);
            this.labelControl8.AllowHtmlString = true;
            this.labelControl8.Location = new Point(15, 13);
            this.labelControl8.Name = "labelControl8";
            this.labelControl8.Size = new Size(0x60, 14);
            this.labelControl8.TabIndex = 6;
            this.labelControl8.Text = "Chọn nh\x00e2n vi\x00ean <color=red>(*)</color>:";
            this.txtEmployeeName.Location = new Point(0xdf, 10);
            this.txtEmployeeName.Name = "txtEmployeeName";
            this.txtEmployeeName.Properties.ReadOnly = true;
            this.txtEmployeeName.Size = new Size(0x17e, 20);
            this.txtEmployeeName.TabIndex = 8;
            this.glkEmployeeCode.Location = new Point(0x75, 10);
            this.glkEmployeeCode.Name = "glkEmployeeCode";
            this.glkEmployeeCode.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.glkEmployeeCode.Properties.NullText = "[Chọn m\x00e3 NV]";
            this.glkEmployeeCode.Properties.View = this.gridLookUpEdit1View;
            this.glkEmployeeCode.Size = new Size(100, 20);
            this.glkEmployeeCode.TabIndex = 7;
            this.glkEmployeeCode.EditValueChanged += new EventHandler(this.glkEmployeeCode_EditValueChanged);
            this.gridLookUpEdit1View.Columns.AddRange(new GridColumn[] { this.colEmployeeCode, this.colFirstName, this.colLastName });
            this.gridLookUpEdit1View.FocusRectStyle = DrawFocusRectStyle.RowFocus;
            this.gridLookUpEdit1View.Name = "gridLookUpEdit1View";
            this.gridLookUpEdit1View.OptionsSelection.EnableAppearanceFocusedCell = false;
            this.gridLookUpEdit1View.OptionsView.ShowAutoFilterRow = true;
            this.gridLookUpEdit1View.OptionsView.ShowGroupPanel = false;
            this.colEmployeeCode.Caption = "M\x00e3 nh\x00e2n vi\x00ean";
            this.colEmployeeCode.FieldName = "EmployeeCode";
            this.colEmployeeCode.Name = "colEmployeeCode";
            this.colEmployeeCode.Visible = true;
            this.colEmployeeCode.VisibleIndex = 0;
            this.colFirstName.Caption = "Họ l\x00f3t";
            this.colFirstName.FieldName = "FirstName";
            this.colFirstName.Name = "colFirstName";
            this.colFirstName.Visible = true;
            this.colFirstName.VisibleIndex = 1;
            this.colLastName.Caption = "T\x00ean";
            this.colLastName.FieldName = "LastName";
            this.colLastName.Name = "colLastName";
            this.colLastName.Visible = true;
            this.colLastName.VisibleIndex = 2;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.labelControl8);
            base.Controls.Add(this.txtEmployeeName);
            base.Controls.Add(this.glkEmployeeCode);
            base.Controls.Add(this.bbiReload);
            base.Controls.Add(this.grInformation);
            base.Name = "xucRateAdd";
            base.Size = new Size(0x269, 0x254);
            base.Controls.SetChildIndex(base.btnSaveNew, 0);
            base.Controls.SetChildIndex(base.btnCancel, 0);
            base.Controls.SetChildIndex(base.btnSave, 0);
            base.Controls.SetChildIndex(this.grInformation, 0);
            base.Controls.SetChildIndex(this.bbiReload, 0);
            base.Controls.SetChildIndex(this.glkEmployeeCode, 0);
            base.Controls.SetChildIndex(this.txtEmployeeName, 0);
            base.Controls.SetChildIndex(this.labelControl8, 0);
            ((ISupportInitialize) base.Err).EndInit();
            base.imageCollection2.EndInit();
            this.grInformation.EndInit();
            this.grInformation.ResumeLayout(false);
            this.layoutControl1.EndInit();
            this.layoutControl1.ResumeLayout(false);
            this.cheIsDiscipline.Properties.EndInit();
            this.txtDescription.Properties.EndInit();
            this.dtDate.Properties.VistaTimeProperties.EndInit();
            this.dtDate.Properties.EndInit();
            this.txtOwnerRate.Properties.EndInit();
            this.calOwnerPlus.Properties.EndInit();
            this.txtMyRate.Properties.EndInit();
            this.calMyPlus.Properties.EndInit();
            this.calMinus.Properties.EndInit();
            this.cheIsRecidivism.Properties.EndInit();
            this.txtViolation.Properties.EndInit();
            this.layoutControlGroup1.EndInit();
            this.layoutControlItem1.EndInit();
            this.layoutControlItem3.EndInit();
            this.layoutControlItem4.EndInit();
            this.layoutControlItem5.EndInit();
            this.layoutControlItem6.EndInit();
            this.layoutControlItem7.EndInit();
            this.layoutControlItem8.EndInit();
            this.layoutControlItem9.EndInit();
            this.layoutControlItem10.EndInit();
            this.layoutControlItem11.EndInit();
            this.layoutControlItem2.EndInit();
            this.emptySpaceItem3.EndInit();
            this.layoutControlItem12.EndInit();
            this.layoutControlItem13.EndInit();
            this.emptySpaceItem1.EndInit();
            this.emptySpaceItem2.EndInit();
            this.gcList.EndInit();
            this.gbList.EndInit();
            this.repCal.EndInit();
            this.gridView2.EndInit();
            this.txtEmployeeName.Properties.EndInit();
            this.glkEmployeeCode.Properties.EndInit();
            this.gridLookUpEdit1View.EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        private void InitMultiLanguages()
        {
            this.grInformation.Text = MultiLanguages.GetString("tbl_ProcessRateAdd", "grInformation", this.grInformation.Text);
        }

        private void LoadEmployeeInformation()
        {
            HRM_EMPLOYEE hrm_employee = new HRM_EMPLOYEE();
            hrm_employee.Get(this.m_EmployeeCode);
            this.grInformation.Text = "Th\x00f4ng Tin Đ\x00e1nh Gi\x00e1  - " + hrm_employee.EmployeeCode + " (" + hrm_employee.FirstName + " " + hrm_employee.LastName + ")";
            this.txtEmployeeName.Text = hrm_employee.FirstName + " " + hrm_employee.LastName;
            this.CreateListRate();
        }

        private void RaiseSuccessEventHander(HRM_PROCESS_RATE item)
        {
            if (this.Success != null)
            {
                this.Success(this, item);
            }
        }

        public void SetCode(string EmployeeCode)
        {
            this.m_EmployeeCode = EmployeeCode;
            if (this.m_EmployeeCode != "")
            {
                this.glkEmployeeCode.EditValue = this.m_EmployeeCode;
                this.glkEmployeeCode.Properties.ReadOnly = true;
                this.txtEmployeeName.Properties.ReadOnly = true;
            }
        }

        public void SetData(HRM_PROCESS_RATE item)
        {
            this.m_RateID = item.RateID;
            SYS_LOG.Insert("Đ\x00e1nh Gi\x00e1 Nh\x00e2n Vi\x00ean", "Xem", this.m_RateID.ToString());
            this.m_EmployeeCode = item.EmployeeCode;
            this.glkEmployeeCode.EditValue = this.m_EmployeeCode;
            if (base.m_Status == Actions.Update)
            {
                this.glkEmployeeCode.Properties.ReadOnly = true;
                this.txtEmployeeName.Properties.ReadOnly = true;
            }
            this.dtDate.DateTime = item.Date;
            this.txtViolation.Text = item.Violation;
            this.cheIsRecidivism.Checked = item.IsRecidivism;
            this.cheIsDiscipline.Checked = item.IsDiscipline;
            this.calMinus.EditValue = item.Minus;
            this.calMyPlus.EditValue = item.MyPlus;
            this.txtMyRate.Text = item.MyRate;
            this.calOwnerPlus.EditValue = item.OwnerPlus;
            this.txtOwnerRate.Text = item.OwnerRate;
            this.txtDescription.Text = item.Description;
            this.gcList.DataSource = new HRM_PROCESS_RATEDETAIL().GetList(this.m_RateID);
        }

        private void SetRate()
        {
            double num = 0.0;
            double num2 = 0.0;
            double num3 = 0.0;
            bool flag = true;
            bool flag2 = true;
            bool flag3 = true;
            bool flag4 = true;
            bool flag5 = true;
            bool flag6 = true;
            try
            {
                foreach (DataRow row in (this.gcList.DataSource as DataTable).Rows)
                {
                    int num4 = int.Parse(row["Sort"].ToString());
                    double num5 = double.Parse(row["Coefficient"].ToString());
                    double num6 = double.Parse(row["SelfScore"].ToString());
                    double num7 = double.Parse(row["Score"].ToString());
                    double num8 = 10.0 - num6;
                    double num9 = 10.0 - num7;
                    double num10 = (10.0 - num6) * num5;
                    double num11 = (10.0 - num7) * num5;
                    num3 += num9;
                    num += num5 * num6;
                    num2 += num5 * num7;
                    if ((num8 < 12.0) && (num8 >= 8.0))
                    {
                        flag = false;
                        flag2 = false;
                    }
                    else if ((num8 < 8.0) && (num8 >= 4.0))
                    {
                        flag = false;
                    }
                    if (num5 > 1.0)
                    {
                        if (num10 >= 12.0)
                        {
                            flag = false;
                            flag2 = false;
                            flag3 = false;
                        }
                        else if ((num10 < 12.0) && (num10 >= 8.0))
                        {
                            flag = false;
                            flag2 = false;
                        }
                        else if ((num10 < 8.0) && (num10 >= 4.0))
                        {
                            flag = false;
                        }
                    }
                    if ((num9 < 12.0) && (num9 >= 8.0))
                    {
                        flag4 = false;
                        flag5 = false;
                    }
                    else if ((num9 < 8.0) && (num9 >= 4.0))
                    {
                        flag4 = false;
                    }
                    if (num5 > 1.0)
                    {
                        if (num11 >= 12.0)
                        {
                            flag4 = false;
                            flag5 = false;
                            flag6 = false;
                        }
                        else if ((num11 < 12.0) && (num11 >= 8.0))
                        {
                            flag4 = false;
                            flag5 = false;
                        }
                        else if ((num11 < 8.0) && (num11 >= 4.0))
                        {
                            flag4 = false;
                        }
                    }
                }
            }
            catch
            {
            }
            this.calMyPlus.EditValue = num;
            this.calOwnerPlus.EditValue = num2;
            this.calMinus.EditValue = num3;
            if (this.cheIsDiscipline.Checked)
            {
                this.txtMyRate.Text = "D";
                this.txtOwnerRate.Text = "D";
            }
            else
            {
                if (flag)
                {
                    if ((num >= 99.0) && (num <= 110.0))
                    {
                        this.txtMyRate.Text = "A";
                    }
                    else if ((num >= 88.0) && (num < 99.0))
                    {
                        this.txtMyRate.Text = "B";
                    }
                    else if ((num >= 77.0) && (num < 88.0))
                    {
                        this.txtMyRate.Text = "C";
                    }
                    else
                    {
                        this.txtMyRate.Text = "D";
                    }
                }
                else if (flag2)
                {
                    if (num >= 88.0)
                    {
                        this.txtMyRate.Text = "B";
                    }
                    else if ((num >= 77.0) && (num < 88.0))
                    {
                        this.txtMyRate.Text = "C";
                    }
                    else
                    {
                        this.txtMyRate.Text = "D";
                    }
                }
                else if (flag3)
                {
                    if (num >= 77.0)
                    {
                        this.txtMyRate.Text = "C";
                    }
                    else
                    {
                        this.txtMyRate.Text = "D";
                    }
                }
                else
                {
                    this.txtMyRate.Text = "D";
                }
                if (flag4)
                {
                    if ((num2 >= 99.0) && (num2 <= 110.0))
                    {
                        this.txtOwnerRate.Text = "A";
                    }
                    else if ((num2 >= 88.0) && (num2 < 99.0))
                    {
                        this.txtOwnerRate.Text = "B";
                    }
                    else if ((num2 >= 77.0) && (num2 < 88.0))
                    {
                        this.txtOwnerRate.Text = "C";
                    }
                    else
                    {
                        this.txtOwnerRate.Text = "D";
                    }
                }
                else if (flag5)
                {
                    if (num2 >= 88.0)
                    {
                        this.txtOwnerRate.Text = "B";
                    }
                    else if ((num2 >= 77.0) && (num2 < 88.0))
                    {
                        this.txtOwnerRate.Text = "C";
                    }
                    else
                    {
                        this.txtOwnerRate.Text = "D";
                    }
                }
                else if (flag6)
                {
                    if (num2 >= 77.0)
                    {
                        this.txtOwnerRate.Text = "C";
                    }
                    else
                    {
                        this.txtOwnerRate.Text = "D";
                    }
                }
                else
                {
                    this.txtOwnerRate.Text = "D";
                }
            }
        }

        private void txtMyRate_TextChanged(object sender, EventArgs e)
        {
            if (this.txtMyRate.Text == "D")
            {
                this.txtMyRate.ForeColor = Color.Red;
            }
            else
            {
                this.txtMyRate.ForeColor = Color.Black;
            }
        }

        private void txtOwnerRate_TextChanged(object sender, EventArgs e)
        {
            if (this.txtOwnerRate.Text == "D")
            {
                this.txtOwnerRate.ForeColor = Color.Red;
            }
            else
            {
                this.txtOwnerRate.ForeColor = Color.Black;
            }
        }

        protected override string uc_Change()
        {
            return string.Empty;
        }

        protected override string uc_Delete()
        {
            HRM_PROCESS_RATE item = new HRM_PROCESS_RATE {
                RateID = this.m_RateID
            };
            string str = item.Delete();
            if (str == "OK")
            {
                this.RaiseSuccessEventHander(item);
            }
            return str;
        }

        protected override string uc_Save()
        {
            if (MyRule.Get(MyLogin.RoleId, "bbiProcessRate") != "OK")
            {
                return "";
            }
            if (!MyRule.AllowAdd)
            {
                MyRule.Notify();
                return "";
            }
            SYS_LOG.Insert("Đ\x00e1nh Gi\x00e1 Nh\x00e2n Vi\x00ean", "Th\x00eam", this.m_RateID.ToString());
            base.SetWaitDialogCaption("Đang lưu dữ liệu...");
            Cursor.Current = Cursors.WaitCursor;
            HRM_PROCESS_RATE item = new HRM_PROCESS_RATE {
                RateID = Guid.NewGuid(),
                EmployeeCode = this.m_EmployeeCode,
                Date = this.dtDate.DateTime,
                Violation = this.txtViolation.Text,
                IsRecidivism = this.cheIsRecidivism.Checked,
                IsDiscipline = this.cheIsDiscipline.Checked
            };
            try
            {
                item.Minus = double.Parse(this.calMinus.EditValue.ToString());
            }
            catch
            {
                item.Minus = 0.0;
            }
            try
            {
                item.MyPlus = double.Parse(this.calMyPlus.EditValue.ToString());
            }
            catch
            {
                item.MyPlus = 0.0;
            }
            item.MyRate = this.txtMyRate.Text;
            try
            {
                item.OwnerPlus = double.Parse(this.calOwnerPlus.EditValue.ToString());
            }
            catch
            {
                item.OwnerPlus = 0.0;
            }
            item.OwnerRate = this.txtOwnerRate.Text;
            item.Description = this.txtDescription.Text;
            string text = item.Insert();
            if (text == "OK")
            {
                HRM_PROCESS_RATEDETAIL hrm_process_ratedetail = new HRM_PROCESS_RATEDETAIL();
                try
                {
                    foreach (DataRow row in (this.gcList.DataSource as DataTable).Rows)
                    {
                        hrm_process_ratedetail.Insert(new Guid(row["RateDetailID"].ToString()), item.RateID, row["Content"].ToString(), double.Parse(row["Coefficient"].ToString()), double.Parse(row["SelfScore"].ToString()), row["SelfRate"].ToString(), double.Parse(row["Score"].ToString()), row["Rate"].ToString(), int.Parse(row["Sort"].ToString()));
                    }
                }
                catch
                {
                }
                this.RaiseSuccessEventHander(item);
            }
            Cursor.Current = Cursors.Default;
            this.DoHide();
            if (text != "OK")
            {
                XtraMessageBox.Show(text, "Cảnh B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return text;
        }

        protected override string uc_Update()
        {
            if (MyRule.Get(MyLogin.RoleId, "bbiProcessRate") != "OK")
            {
                return "";
            }
            if (!MyRule.AllowEdit)
            {
                MyRule.Notify();
                return "";
            }
            SYS_LOG.Insert("Đ\x00e1nh Gi\x00e1 Nh\x00e2n Vi\x00ean", "Cập Nhật", this.m_RateID.ToString());
            base.SetWaitDialogCaption("Đang cập nhật dữ liệu...");
            HRM_PROCESS_RATE item = new HRM_PROCESS_RATE {
                RateID = this.m_RateID,
                EmployeeCode = this.m_EmployeeCode,
                Date = this.dtDate.DateTime,
                Violation = this.txtViolation.Text,
                IsRecidivism = this.cheIsRecidivism.Checked,
                IsDiscipline = this.cheIsDiscipline.Checked
            };
            try
            {
                item.Minus = double.Parse(this.calMinus.EditValue.ToString());
            }
            catch
            {
                item.Minus = 0.0;
            }
            try
            {
                item.MyPlus = double.Parse(this.calMyPlus.EditValue.ToString());
            }
            catch
            {
                item.MyPlus = 0.0;
            }
            item.MyRate = this.txtMyRate.Text;
            try
            {
                item.OwnerPlus = double.Parse(this.calOwnerPlus.EditValue.ToString());
            }
            catch
            {
                item.OwnerPlus = 0.0;
            }
            item.OwnerRate = this.txtOwnerRate.Text;
            item.Description = this.txtDescription.Text;
            string text = item.Update();
            if (text == "OK")
            {
                this.RaiseSuccessEventHander(item);
                HRM_PROCESS_RATEDETAIL hrm_process_ratedetail = new HRM_PROCESS_RATEDETAIL();
                hrm_process_ratedetail.DeleteAll(this.m_RateID);
                try
                {
                    foreach (DataRow row in (this.gcList.DataSource as DataTable).Rows)
                    {
                        hrm_process_ratedetail.Insert(new Guid(row["RateDetailID"].ToString()), this.m_RateID, row["Content"].ToString(), double.Parse(row["Coefficient"].ToString()), double.Parse(row["SelfScore"].ToString()), row["SelfRate"].ToString(), double.Parse(row["Score"].ToString()), row["Rate"].ToString(), int.Parse(row["Sort"].ToString()));
                    }
                }
                catch
                {
                }
            }
            if (text != "OK")
            {
                XtraMessageBox.Show(text, "Cảnh B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            this.DoHide();
            return text;
        }

        public delegate void SuccessEventHander(object sender, HRM_PROCESS_RATE item);
    }
}

